home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / BSPROTO.H < prev    next >
Text File  |  1995-08-23  |  22KB  |  868 lines

  1. //---------------------------------------------------------------------------- 
  2. //                            MODULE DESCRIPTION
  3. //
  4. //  Module:    bsproto.h
  5. //   Title:    Base library
  6. //  Notice:    John M. Weeder
  7. //                 Copyright (c) 1993. All rights reserved.
  8. //             This module contains proprietary information and should be 
  9. //                treated as confidential.
  10. //
  11. //----------------------------------------------------------------------------
  12. //                           MAINTENANCE HISTORY
  13. //
  14. // $Workfile$
  15. // $Revision$
  16. //   $Author$
  17. //     $Date$
  18. //      $Log$    
  19. //
  20. //----------------------------------------------------------------------------
  21. //                             MODULE NARRATIVE
  22. //
  23. //
  24. //    This module contains prototypes and other information for files included 
  25. //    in the base library.
  26. //
  27. //    The code in this module should be written entirely in C. 
  28. //    Do not use any C++ constructs.
  29. //
  30. //    This module is portable to:
  31. //        DOS 3.X+
  32. //        MS Windows 3.X+
  33. //        OS/2 2.X+
  34. //        OS/2 2.0 PM
  35. //        SCO UNIX.
  36. //
  37. //    The following compilers are supported:
  38. //        MSC 6.0A
  39. //        MSC/C++ 7.0
  40. //        Borland C++ 3.1 for DOS
  41. //        Borland C++ 1.0 for OS/2 2.X
  42. //        SCO UNIX cc
  43. //
  44. //----------------------------------------------------------------------------
  45.  
  46.  
  47. //----------------------------------------------------------------------------
  48. //    Windows NT
  49. //    Some Windows NT API names conflict with base library function names.
  50. //    For example: Sleep()
  51. //    These macros redefine some of these names so that they don't conflict.
  52. //----------------------------------------------------------------------------
  53. #if OS_NT
  54. #define Sleep    BaseSleep
  55. #endif
  56.  
  57.  
  58. //----------------------------------------------------------------------------
  59. //    Prototypes
  60. //----------------------------------------------------------------------------
  61.  
  62. //
  63. //    bsassert.c
  64. //
  65. #if COMPILE_DEBUG
  66. #    define Assert(exp)        ((exp) ? (void)0 : \
  67.                                     ((void)DebugSetLocation(__FILE__,__LINE__),\
  68.                                     (void)Assert_Debug(#exp)))
  69. #else
  70. #    define Assert(exp)
  71. #endif
  72.  
  73. BOOL FN_E Assert_Debug(PCSZ);
  74.       
  75.  
  76. //
  77. //    bsbcd.c
  78. //
  79. VOID FN_E stra2b(PBYTE, SIZET, PCCHAR, SIZET);
  80. VOID FN_E strb2a(PCBYTE, SIZET, PCHAR, SIZET, BOOL);
  81.  
  82.  
  83. //
  84. //    bsboot.c
  85. //
  86. VOID FN_E Boot(BOOL);
  87.  
  88.  
  89. //
  90. //    bscfg.c
  91. //
  92. #define MAX_CFG_NAME            (227)            // Maximum configuration file name size
  93.  
  94. BOOL FN_E CfgClose(void);
  95. BOOL FN_E CfgDelete(PCSZ);
  96. BOOL FN_E CfgFind(PCSZ);
  97. BOOL FN_E CfgFindClose(void);
  98. BOOL FN_E CfgFindFirst(PSZ);
  99. BOOL FN_E CfgFindNext(PSZ);
  100. BOOL FN_E CfgOpen(PCSZ);
  101. BOOL FN_E CfgRead(PCSZ, PBYTE _FAR_ *, PSIZET);
  102. VOID FN_E CfgSetCache(SIZET);
  103. BOOL FN_E CfgWrite(PCSZ, PBYTE, SIZET);
  104.  
  105.  
  106. //
  107. //    bscmdlin.c
  108. //
  109. #define CMDOPT_SWITCH         (0x0000)        // A simple switch (/T)
  110. #define CMDOPT_BOOL             (0x0100)        // Boolean, no default (/T+, /T-)
  111. #define CMDOPT_TRUE            (0x1100)        // Boolean, default true (/T, /T+, /T-)
  112. #define CMDOPT_FALSE            (0x2100)        // Boolean, default false (/T, /T+, /T-)
  113. #define CMDOPT_NUMERIC        (0x0200)        // Numeric (/T=500)
  114.                                                     // Text (/T:"TEXT")
  115. #define _CMDOPT_TEXT            (0x0400)
  116. #define CMDOPT_TEXT(x)        (_CMDOPT_TEXT+((x) & 0x00FF))
  117.                                                     // File specification (non-switch)
  118. #define _CMDOPT_FILESPEC    (0x0800)
  119. #define CMDOPT_FILESPEC(x)    (_CMDOPT_FILESPEC+((x) & 0x00FF))
  120. #define CMDOPT_REQUIRED        (0x1000)        // File name required!
  121. #define CMDOPT_FILESPECR(x)(CMDOPT_FILESPEC(x)|CMDOPT_REQUIRED)
  122. #define CMDOPT_REQUIRED        (0x1000)        // File name required!
  123. #define CMDOPT_USED            (0x2000)        // Option found on command line
  124. #define CMDOPT_NO_DFT         (0x4000)        // Don't display default parameter value
  125. #define CMDOPT_CASE            (0x8000)        // Case sensitive
  126. #define CMDOPT_NO_CASE        (0x0000)        // Case insensitive
  127. #define _CMDOPT_SIZE            (0x00FF)        // Buffer size mask
  128.                                                     // Lower byte is maximum length
  129.                                                 ///// Processing flags!
  130. #define CMDOPT_NO_ERR        (0x0001)        // Ignore all processing errors
  131.  
  132. typedef struct _BS_CMDOPT                    // Command line option structure
  133. {                                                    // See bscmdlin.c
  134.     PSZ psz;                                        // Option name
  135.     PVOID pv;                                    // Option value.
  136.     FLAG16 fs;                                    // Option flags
  137.     PSZ pszDesc;                                // Option description
  138. } BS_CMDOPT;
  139.  
  140. BASETYPE(BS_CMDOPT);
  141.  
  142. #define BS_CMDOPT_NULL        { NULL, NULL, 0, NULL }
  143.  
  144. PSZ FN_E CommandLineAppName(void);
  145. PSZ FN_E CommandLineAppPath(void);
  146.  
  147. BOOL FN_E CommandLineProcess(PBS_CMDOPT, FLAG16 DFTPARM(0));
  148.  
  149.  
  150. //
  151. //    bscprite.c
  152. //
  153. typedef enum _CFG_PARM
  154.     {
  155.     CFG_COPYRIGHT = 0,
  156.     CFG_VERSION,
  157.     CFG_SERIAL_NO,
  158.     CFG_PROGRAM_ID,
  159.     CFG_PROGRAM_NAME,
  160.     CFG_ACCESS,
  161.     CFG_REGISTER,
  162.     CFG_MAX,
  163.     CFG_ALL,                                        // Set all parameters
  164.     CFG_CLEAR,                                    // Clear structure
  165.     } CFG_PARM;
  166.  
  167. typedef struct _BS_CFG
  168. {
  169.     CHAR szLocater[10+1];                    // Locater string
  170.     CHAR chGarble;                                // If structure garbled?
  171.     CHAR szCopyright[80+1];                    // Copyright notice
  172.     CHAR szVersion[20+1];                    // Program version string
  173.     CHAR szSerialNo[8+1];                    // Program serial #
  174.     CHAR szProgramId[8+1];                    // Program identification string
  175.      CHAR szProgramName[80+1];                // Program name
  176.     CHAR szAccess[8+1];                        // Program access code
  177.      CHAR szRegister[80+1];                    // Registered to
  178. } BS_CFG;
  179. BASETYPE(BS_CFG);
  180.  
  181.  
  182. VOID FN_E CfgGarble(PBS_CFG);
  183. PCSZ FN_E CfgGet(CFG_PARM, PBS_CFG DFTPARM(NULL));
  184. BOOL FN_E CfgSet(PCSZ, CFG_PARM, PBS_CFG DFTPARM(NULL));
  185.  
  186.  
  187. //
  188. //    bscpu.c
  189. //
  190. SIZET FN_E Cpu(void);
  191. PCSZ FN_E CpuName(void);
  192.  
  193.  
  194. //
  195. //    bscrc.c
  196. //
  197. CRC FN_E CrcCalc(PCBYTE, SIZET);
  198. CRC FN_E CrcCalcAppend(PCBYTE, SIZET, CRC);
  199. BOOL FN_E CrcFile(PCSZ, PCRC);
  200. CRC FN_E CrcCalcStr(PCSZ);
  201.  
  202.  
  203. //
  204. //    bscrierr.c
  205. //
  206. USHORT FN_E CritErr(void);
  207. VOID FN_E CritErrReset(void);
  208.  
  209.  
  210. //
  211. //    bscrisec.c
  212. //
  213. VOID FN_E CritSecEnter(void);
  214. VOID FN_E CritSecExit(void);
  215.  
  216.  
  217. //
  218. //    bsdebug.c
  219. //
  220. BOOL FN_E DebugSetLocation(PSZ, SIZET);
  221. BOOL FN_E DebugMode(void);
  222.  
  223.  
  224. //
  225. //    bsdisp.c
  226. //
  227. BOOL FN_E DisplayIsVGA(void);
  228.  
  229.  
  230. //
  231. //    bsdrive.c
  232. //
  233. enum DRIVE_TYPE
  234.     {
  235.     DRV_360 = 0,
  236.     DRV_FIRST = DRV_360,
  237.     DRV_12,
  238.     DRV_720,
  239.     DRV_8_SD,
  240.     DRV_8_DD,
  241.     DRV_FIXED,
  242.     DRV_TAPE,
  243.     DRV_144,
  244.     DRV_OTHER,
  245.     DRV_LAST = DRV_OTHER,
  246.     DRV_MAX
  247.     };
  248. SHORT FN_E DriveGet(void);
  249. BOOL FN_E DriveIsRemote(SHORT);
  250. BOOL FN_E DriveIsValid(SHORT, PSHORT);
  251. BOOL FN_E DriveSet(SHORT);
  252. SHORT FN_E DriveSize(SHORT, PLONG, PLONG);
  253. SHORT FN_E DriveType(SHORT);
  254.  
  255. //
  256. //    bsebcdic.c
  257. //
  258. PSZ FN_E stra2e(PSZ);
  259. PSZ FN_E stre2a(PSZ);
  260.  
  261.  
  262. //
  263. //    bsenv.c
  264. //
  265. BOOL FN_E EnvCheck(PCSZ, PCSZ);
  266. PCSZ FN_E EnvGet(PCSZ);
  267. LONG FN_E EnvVal(PCSZ);
  268.  
  269.  
  270. //
  271. //    bserror.c
  272. //
  273. #define Error                DebugSetLocation(__FILE__,__LINE__),\
  274.                                 Error_Debug
  275. #define _Error                DebugSetLocation(__FILE__,__LINE__),\
  276.                                 ::Error_Debug
  277. #define ErrorNoMem()        ErrorNoMem_Debug(__FILE__,__LINE__)
  278. #define _ErrorNoMem()    ::ErrorNoMem_Debug(__FILE__,__LINE__)
  279. #define ErrorV(x,y)        DebugSetLocation(__FILE__,__LINE__),\
  280.                                 ErrorV_Debug((x),(y))
  281. #define Fatal                DebugSetLocation(__FILE__,__LINE__),\
  282.                                 Fatal_Debug
  283. #define Invalid            DebugSetLocation(__FILE__,__LINE__),\
  284.                                 Invalid_Debug
  285. #define NotImplemented    DebugSetLocation(__FILE__,__LINE__),\
  286.                                 NotImplemented_Debug
  287.  
  288. typedef SHORT (FN_E *PFNERR)(PCSZ);
  289.  
  290. BOOL FN_EV Error_Debug(PCSZ, ...);
  291. BOOL FN_EV ErrorNoMem_Debug(PCSZ, SIZET);
  292. BOOL FN_E ErrorSetDisplay(PFNERR);
  293. BOOL FN_E ErrorV_Debug(PCSZ, va_list);
  294. BOOL FN_EV Fatal_Debug(PCSZ, ...);
  295. BOOL FN_E Invalid_Debug(PCSZ);
  296. BOOL FN_E NotImplemented_Debug(PCSZ);
  297.  
  298. //
  299. //    bsfcopy.c
  300. //
  301.  
  302. #define FCOPY_NO_NEWER            (0x0001)    // Don't overwrite newer files
  303. #define FCOPY_BACKUP                (0x0002)    // Create backup
  304. #define FCOPY_NO_DATE            (0x0004)    // Don't preserve date.
  305. #define FCOPY_NO_OVERWRITE        (0x0008)    // Don't overwrite existing.
  306. #define FCOPY_APPEND                (0x0010)    // Append to existing
  307. #define FCOPY_RW                    (0x0020)    // Clear read-only (CD always has readonly)
  308.  
  309. #define FCOPY_NEWER_EXISTS        (0x0001)
  310. #define FCOPY_BACKUP_CREATED    (0x0002)
  311. #define FCOPY_DST_EXISTS        (0x0004)
  312. #define FCOPY_FILE_COPIED        (0x0008)
  313.  
  314. BOOL FN_E CopyFile(PCSZ, PCSZ, FLAG16, PUSHORT);
  315.  
  316. //
  317. // bsfile.c
  318. //
  319. typedef LONG                 FPOS;            // fpos; File position
  320. BASETYPE(FPOS);
  321.  
  322. #if OS_OS2 || OS_UNIX
  323. typedef LONG                     HF;            // hf; Handle, File
  324. #else
  325. typedef SHORT                     HF;            // hf; Handle, File
  326. #endif
  327. BASETYPE(HF);
  328.  
  329. enum _FILE_SEEK
  330.     {
  331.     FL_BEGIN                = 0x0000,            // Seek from beginning
  332.     FL_CURRENT            = 0x0001,             // Seek from current
  333.     FL_END                = 0x0002,             // Seek from end
  334.     };
  335.                                                  /////    Open modes
  336. #define FL_OPEN             (0x00000001L)    // Open file, fail if exists
  337. #define FL_TRUNCATE        (0x00000002L)    // Open file, truncate if exists
  338. #define FL_CREATE           (0x00000004L)    // Open file, create if doesn't exist
  339. #define FL_OPEN_MODE     (0x0000000FL)    // Open mode mask
  340.                                                 /////    Read/write modes
  341. #define FL_READONLY         (0x00000010L)    // Read only
  342. #define FL_WRITEONLY         (0x00000020L)    // Write only
  343. #define FL_READWRITE         (0x00000040L)    // Read and write
  344. #define FL_RW_MODE       (0x000000F0L)    // Read/write mode mask
  345.                                                 ///// Sharing modes
  346. #define FL_DENYREADWRITE (0x00000100L)    // Deny read and write
  347. #define FL_DENYWRITE         (0x00000200L)    // Deny write
  348. #define FL_DENYREAD        (0x00000400L)    // Deny read
  349. #define FL_DENYNONE         (0x00000800L)    // Deny none
  350. #define FL_SH_MODE       (0x00000F00L)    // Share mode mask
  351.                                                 ///// Text/binary mode
  352. #define FL_TEXT             (0x00001000L)    // Open in text mode
  353. #define FL_BINARY             (0x00002000L)    // Open in binary mode (Default)
  354. #define FL_TEXT_MODE     (0x0000F000L)    // Text/binary mode mask
  355.                                                 /////    Flags
  356. #define FL_BUFFERED         (0x00010000L)    // Open file for buffered i/o (read-only?)
  357. #define FL_IGNORE_CASE     (0x00020000L)    // Tokenizer should ignore case
  358. #define FL_TOKEN             (0x00040000L)    // Open for tokenizing (implies buffered)
  359. #define FL_APPEND          (0x00080000L)    // Append to file
  360. #define FL_FLAGS         (0x000F0000L)    // Flags mask
  361. #define FL_ALL           (0x000FFFFFL)    // All flags
  362.                                                 ///// Compisite open modes
  363. #define FL_O_TOKEN         (0x02000000L)    // Open for tokenizing
  364. #define FL_O_RT             (0x04000000L)    // Open for text read
  365. #define FL_O_WT              (0x08000000L)    // Open for text write
  366. #define FL_O_AT              (0x10000000L)    // Open for text appending
  367. #define FL_O_R                 (0x20000000L)    // Open for binary read
  368. #define FL_O_RW             (0x40000000L)    // Open for binary read/write
  369. #define FL_O_T                 (0x80000000L)    // Truncate and open for read/write
  370.  
  371. enum _FL_OPENACTION
  372.     {
  373.     FL_FAILED             = 0x0001,            // Open failed
  374.     FL_TRUNCATED       = 0x0002,            // File was truncated
  375.     FL_EXISTED            = 0x0004,            // File existed
  376.     FL_CREATED            = 0x0008,            // File was created
  377.     };
  378.  
  379. BOOL FN_E FileClose(HF);
  380. BOOL FN_E FileCloseAll(void);
  381. BOOL FN_EV FileError(HF, PCSZ, ...);
  382. BOOL FN_E FileErrorV(HF, PCSZ, va_list);
  383. BOOL FN_E FileFill(HF, FPOS, FPOS, BYTE);
  384. BOOL FN_E FileFlush(HF);
  385. FPOS FN_E FileGetPos(HF);
  386. FPOS FN_E FileGetSize(HF);
  387. BOOL FN_E FileIsError(HF);
  388. BOOL FN_E FileIsRedirected(void);
  389. BOOL FN_E FileLock(HF, FPOS, FPOS);
  390. BOOL FN_E FileOpen(PHF, PCSZ, FLAG32, PFLAG16 DFTPARM(NULL));
  391. BOOL FN_E FileRead(HF, PVOID, SIZET, FPOS DFTPARM(-1L));
  392. BOOL FN_E FileSetMaxHandles(SHORT);
  393. BOOL FN_E FileSetNoinherit(void);
  394. BOOL FN_E FileSetPos(HF, FPOS, USHORT);
  395. BOOL FN_E FileSetSize(HF, FPOS);
  396. BOOL FN_E FileUnlock(HF, FPOS, FPOS);
  397. BOOL FN_E FileWrite(HF, PCVOID, SIZET, FPOS DFTPARM(-1L));
  398.  
  399. //
  400. //    bsfile1.c
  401. //
  402. BOOL FN_E FileCopy(HF, FPOS, HF, FPOS DFTPARM(-1L), FPOS DFTPARM(-1L));
  403. BOOL FN_E FileCrc(HF, PCRC, FPOS DFTPARM(-1L), FPOS DFTPARM(-1L));
  404. BOOL FN_E FileGarble(HF, PCSZ, FPOS DFTPARM(-1L), FPOS DFTPARM(-1L));
  405.  
  406. //
  407. //    bsfile2.c
  408. //
  409. ULONG FN_E FileLine(HF);
  410. PCSZ FN_E FileName(HF);
  411. BOOL FN_E FileReadStr(HF, PCHAR, SIZET);
  412.  
  413.  
  414. //
  415. //    bsfile3.c
  416. //    Text output
  417. //
  418. BOOL FN_E FileWrapStr(HF, PCSZ, SIZET);
  419. BOOL FN_E FileWriteStr(HF, PCSZ);
  420. BOOL FN_EV FileWriteStrf(HF, PCSZ, ...);
  421. BOOL FN_E FileWriteStrq(HF, PCSZ);
  422.  
  423.  
  424. //
  425. //    bsfile4.c
  426. //    Tokenizer
  427. //
  428. typedef enum
  429.           {
  430.           /* Token generated by tokenizer */
  431. /* 0*/    TOK_ERROR = 0,                        // Token is error
  432. /* 1*/    TOK_KEYWORD,                        // Token is a key word
  433. /* 2*/    TOK_OPERATOR,                        // Token is an operator
  434. /* 3*/    TOK_IDENTIFIER,                    // Token is an identifier (text, but no keyword)
  435. /* 4*/    TOK_INTEGER,                        // Token is a long integer. Integer is always
  436.                                                  //  positive. Unary minus is handled by parser.
  437. /* 5*/    TOK_WHITESPACE,                    // Token is white space
  438. /* 6*/    TOK_SOL,                                // Start of line
  439. /* 7*/    TOK_EOL,                                // End of line
  440. /* 8*/    TOK_SOF,                                // Start of file
  441. /* 9*/    TOK_EOF,                                // End of file
  442. /*10*/    TOK_SSTRING,                        //    Single quoted string
  443. /*11*/    TOK_DSTRING,                        // Double quoted string
  444. /*12*/    TOK_MAX,
  445.             } TOKEN;
  446. BASETYPE(TOKEN);
  447.  
  448. BOOL FN_E FileTokenClearEol(HF);
  449. SHORT FN_E FileTokenKeyword(HF);
  450. TOKEN FN_E FileTokenNext(HF);
  451. TOKEN FN_E FileTokenNextLine(HF, SHORT);
  452. TOKEN FN_E FileTokenNextNonSpace(HF, SHORT);
  453. BOOL FN_E FileTokenOpen(PHF, PCSZ, FLAG32, PPSZ, PPSZ);
  454. SHORT FN_E FileTokenOperator(HF);
  455. PCSZ FN_E FileTokenText(HF);
  456. TOKEN FN_E FileTokenType(HF);
  457. LONG FN_E FileTokenValue(HF);
  458.  
  459.  
  460. //
  461. //    bsfinfo.c
  462. //
  463. typedef struct _BS_FINFO
  464. {
  465. #if OS_OS2
  466.     CHAR szFname[256];                        // File name
  467. #else
  468.     CHAR szFname[13];
  469. #endif
  470.     USHORT usAttrib;                            // File attributes
  471.     LONG lSize;                                    // File size
  472.     TIMET timet;                                // Time last modified
  473. } BS_FINFO;
  474. BASETYPE(BS_FINFO);
  475. BOOL FN_E FinfoFindClose(PVOID);
  476. PVOID FN_E FinfoFindFirst(PCSZ, USHORT, PBS_FINFO);
  477. BOOL FN_E FinfoFindNext(PVOID, PBS_FINFO);
  478. BOOL FN_E FinfoGet(PCSZ, PBS_FINFO);
  479. BOOL FN_E FinfoSet(PCSZ, PBS_FINFO);
  480.  
  481.  
  482. //
  483. //    bsfname
  484. //
  485. enum FNAME_SEPARATOR
  486.     {
  487.     FNAME_CHECK,                                // Check if separator exists
  488.     FNAME_ADD,                                    // Add separator
  489.     FNAME_DELETE,                                // Delete separator
  490.     FNAME_DIR                                    // Directory separator format
  491.     };   
  492. enum FNAME_QUALIFY
  493.     {
  494.     FNAME_NO_CREATE =    0x0001,                // Don't create name
  495.    FNAME_CUR_DIR     =    0x0002,                // Create in current directory
  496.    FNAME_APP_DIR     =    0x0004,                // Create in application directory
  497.     };
  498.  
  499. BOOL FN_E FnameAppendExt(PSZ, PCSZ, BOOL);
  500. BOOL FN_E FnameDelete(PCSZ);
  501. BOOL FN_E FnameDeleteFileSpec(PCSZ);
  502. BOOL FN_E FnameExists(PCSZ);
  503. BOOL FN_E FnameFullPath(PSZ);
  504. BOOL FN_E FnameGetDrivePath(PSZ, SHORT);
  505. BOOL FN_E FnameGetPath(PSZ, SHORT);
  506. BOOL FN_E FnameIsDirectory(PCSZ);
  507. BOOL FN_E FnameIsFile(PCSZ);
  508. BOOL FN_E FnameIsRoot(PCSZ);
  509. BOOL FN_E FnameIsWriteable(PCSZ);
  510. BOOL FN_E FnameMakeDir(PCSZ);
  511. BOOL FN_E FnameMakePath(PSZ, PCSZ, PCSZ, PCSZ, PCSZ);
  512. BOOL FN_E FnameNormalize(PSZ, USHORT);
  513. BOOL FN_E FnameQualify(PSZ, PCSZ, PCSZ, USHORT);
  514. BOOL FN_E FnameRemoveDir(PCSZ);
  515. BOOL FN_E FnameRename(PCSZ, PCSZ);
  516. BOOL FN_E FnameSeparator(PSZ, USHORT);
  517. BOOL FN_E FnameSetPath(PCSZ);
  518. BOOL FN_E FnameSplitPath(PCSZ,PSZ,PSZ,PSZ,PSZ,PSZ);
  519. BOOL FN_E FnameTempFile(PSZ, PCSZ, PCSZ, PCSZ);
  520. PSZ FN_E FnameTempName(PSZ, PCSZ);
  521.  
  522. //
  523. //    bsgarble.c                                        
  524. //
  525. VOID FN_E Garble(PBYTE, SIZET, PBYTE, SIZET);
  526. BOOL FN_E GarbleFile(PCSZ, PCSZ);
  527. VOID FN_E GarbleStr(PSZ, PCSZ);
  528.  
  529. //
  530. //    bshalt.c
  531. //
  532. #define Halt(x)                DebugSetLocation(__FILE__,__LINE__),\
  533.                                     Halt_Debug(x)
  534.  
  535. BOOL FN_E Halt_Debug(PCSZ);
  536.  
  537. //
  538. //    bsheap.c
  539. //
  540. PVOID FN_E MemAlloc_Debug(PCSZ, SIZET, SIZET);
  541. PVOID FN_E MemAllocZero_Debug(PCSZ, SIZET, SIZET);
  542. PVOID FN_E MemRealloc_Debug(PCSZ, SIZET, SIZET, PVOID);
  543. PCSZ FN_E MemStrDup_Debug(PCSZ, SIZET, PCSZ);
  544.  
  545. PVOID FN_E MemAlloc(SIZET);
  546. PVOID FN_E MemAllocZero(SIZET);
  547. PVOID FN_E MemRealloc(SIZET, PVOID);
  548. PSZ FN_E MemStrDup(PCSZ);
  549.  
  550. #if COMPILE_DEBUG
  551. #define MemAlloc(x)            MemAlloc_Debug(__FILE__,__LINE__,(x))
  552. #define MemAllocZero(x)        MemAllocZero_Debug(__FILE__,__LINE__,(x))
  553. #define MemRealloc(x,y)        MemRealloc_Debug(__FILE__,__LINE__,(x),(y))
  554. #define MemStrDup(x)            MemStrDup_Debug(__FILE__,__LINE__,(x))
  555. #endif
  556.  
  557. PVOID FN_E MemFree(PVOID);
  558. BOOL FN_E MemIsLowMemory(void);
  559.  
  560. //
  561. //    bsinit.c
  562. //
  563. typedef VOID (FN_E *PFNEXIT)(void);
  564. BOOL FN_E BaseExitFunc(PFNEXIT, SIZET DFTPARM(0));
  565.  
  566. #if OS_WINDOWS
  567. VOID FN_E BaseLibraryInitialize(HINSTANCE, HINSTANCE, LPSTR, int, PBS_CFG);
  568.  
  569. HINSTANCE FN_E WindowsInstance(void);
  570. HWND FN_E WindowsMainWindow(void);
  571. VOID FN_E WindowsSetMainWindow(HWND);
  572.  
  573. #else
  574. VOID FN_E BaseLibraryInitialize(int, char **, PBS_CFG);
  575. #endif
  576. VOID FN_E BaseLibraryTerminate(void);
  577.  
  578.  
  579.  
  580.  
  581. //
  582. //    bsio.c
  583. //
  584. BOOL FN_E Input(PSZ, SIZET);
  585. VOID FN_EV Output(PCSZ, ...);
  586. VOID FN_E OutputDisable(BOOL);
  587. VOID FN_EV OutputL(SIZET, PCSZ, ...);
  588. BOOL FN_E OutputRunLog(void);
  589. BOOL FN_E OutputScreen(void);
  590. VOID FN_E OutputV(PCSZ, va_list);
  591. VOID FN_E OutputZ(PCSZ);
  592.  
  593.  
  594. //
  595. //    bskbd.c
  596. //
  597. INT FN_EA KbdChar(void);
  598. VOID FN_E KbdFlush(void);
  599. BOOL FN_E KbdIsInsert(void);
  600. INT FN_EA KbdReady(void);
  601. USHORT FN_EA KbdState(void);
  602.  
  603.  
  604. //
  605. //    bslev.c
  606. //
  607. #define MAX_LEV_DISTANCE        (100)
  608. SHORT FN_E Levenstein(PCSZ, PCSZ);
  609.  
  610.  
  611. //
  612. //    bslog.c
  613. //
  614. #define Log                DebugSetLocation(__FILE__,__LINE__),\
  615.                             Log_Debug
  616.  
  617. BOOL FN_EV Log_Debug(USHORT, PCSZ pcsz, ...);
  618. BOOL FN_E LogEnabled(void);
  619. USHORT FN_E LogGetLevel(void);
  620. VOID FN_E LogSetLevel(USHORT usNewLevel);
  621. BOOL FN_E LogTruncate(void);
  622.  
  623. //
  624. //    bsmem.c
  625. //
  626. PVOID FN_E memdel(PVOID, SIZET, SIZET, SIZET);
  627. PVOID FN_E memins(PVOID, SIZET, PVOID, SIZET, SIZET);
  628. PUSHORT FN_EA memsetw(PUSHORT, USHORT, SIZET);
  629.  
  630. //
  631. //    bsmeta.c
  632. //
  633. #define MAX_PHONETIC        (20)                // Maximum length of phonetic in bytes!
  634. VOID FN_E AlNumKey(PCSZ, PBYTE, SIZET);
  635. VOID FN_E Metaphone(PCSZ, PBYTE, SIZET);
  636.  
  637.  
  638. //
  639. //    bsmscdex.c
  640. //
  641. BOOL FN_E MscdexFirstDrive(PSHORT);
  642. BOOL FN_E MscdexIsCdrom(SHORT);
  643. BOOL FN_E MscdexIsInstalled(void);
  644.  
  645.  
  646. //
  647. //    bspasswd.c
  648. //
  649. ULONG FN_E PasswordGet(PCSZ, PCSZ);
  650. BOOL FN_E PasswordVerify(PCSZ, PCSZ, ULONG);
  651.  
  652.  
  653. //
  654. //    bspid.c
  655. //
  656. PID FN_E Pid(void);
  657.  
  658.  
  659. //
  660. //    bsprgman.c
  661. //
  662. BOOL FN_E ProgManClose(void);
  663. BOOL FN_E ProgManCreateGroup(PCSZ, PCSZ);
  664. BOOL FN_E ProgManCreateItem(PCSZ, PCSZ, PCSZ);
  665. BOOL FN_E ProgManOpen(void);
  666.  
  667.  
  668. //
  669. //    bsprint.c
  670. //
  671.  
  672. //
  673. //    Printer callback function.
  674. //    Parameter is a printer error code (currently undefined).
  675. //    Returns TRUE to continue printing or FALSE to abort.
  676. //
  677. #define PRT_LPT1                    (0x0000)        // Print to LPT1 (DOS only)
  678. #define PRT_LPT2                    (0x0001)        // Print to LPT2 (DOS only)
  679. #define PRT_LPT3                    (0x0002)        // Print to LPT3 (DOS only)
  680. #define PRT_LPT4                    (0x0004)        // Print to LPT4 (DOS only)
  681. #define PRT_DELETE_SPOOL        (0x0010)        // Delete spool file on success
  682.  
  683. #define PRT_ESCAPE                (0x1B)        // Printer escape code
  684.  
  685. typedef BOOL (FN_E *PFNPRINT)(SHORT);
  686. BOOL FN_E PrintFile(PCSZ, FLAG16, PFNPRINT, PCSZ);
  687.  
  688. #if OS_DOS
  689. #define PRT_ERR_TIME_OUT        (0x0001)
  690. #define PRT_ERR_IO                (0x0008)
  691. #define PRT_ERR_NOT_SELECTED    (0x0010)
  692. #define PRT_ERR_OUT_OF_PAPER    (0x0020)
  693. #define PRT_ERR_NO_ACK            (0x0040)
  694. #define PRT_ERR_BUSY                (0x0080)
  695. #define PRT_ERR_FILE_ERR        (0x8000)
  696.  
  697. USHORT FN_E DosPrintLine(PCSZ, USHORT);
  698. #endif
  699.  
  700.  
  701. //
  702. //    bsprtscr.c
  703. //
  704. VOID FN_E PrintScreen(BOOL);
  705.  
  706.  
  707. //
  708. //    bspsize.c
  709. //
  710. VOID FN_E ProgramSize(PLONG, PLONG);
  711. VOID FN_E ProgramSizeShow(PCSZ);
  712.  
  713.  
  714. //
  715. //    bsquery.c
  716. //
  717. VOID FN_E QueryGenerate(PSZ);
  718. VOID FN_E QueryResponse(PSZ, PCSZ);
  719. BOOL FN_E QueryVerify(PCSZ, PCSZ, PCSZ);
  720.  
  721.  
  722. //
  723. //    bsrandom.c
  724. //
  725. SIZET FN_E Random(SIZET, SIZET);
  726.  
  727.  
  728. //
  729. //    bsrev.c
  730. //
  731. PSZ FN_E Revision(PSZ);
  732.  
  733.  
  734. //
  735. //    bssleep.c
  736. //
  737. VOID FN_E Sleep(ULONG);
  738.  
  739. //
  740. //    bssound.c
  741. //
  742. BOOL FN_E Sound(BOOL);
  743. VOID FN_E SoundBeep(void);
  744. VOID FN_EA SoundNote(USHORT, USHORT);
  745. VOID FN_E SoundPlay(PUSHORT);
  746.  
  747. //
  748. //    bsstr.c
  749. //
  750. PPSZ FN_E str2array(PSZ, PPSZ, SIZET);
  751. PSZ FN_E strarray2str(PPSZ, SIZET, PSZ);
  752. SIZET FN_E strarraycnt(PPSZ);
  753. PCSZ FN_E strarrayfind(PSZ, PPSZ, SIZET);
  754. SIZET FN_E strarraysize(PCSZ);
  755. BOOL FN_E strarraysort(PPSZ, SIZET);
  756. PSZ FN_E strcats(PSZ, PCSZ);
  757. SIZET FN_E strcnt(PSZ, CHAR);
  758. PSZ FN_E    strdel(PSZ, SIZET, SIZET);
  759. BOOL FN_E strextract(PSZ, PCSZ, SIZET, PCSZ);
  760. ULONG FN_E strhash(PCSZ);
  761. PSZ FN_E strins(PSZ, PSZ, SIZET);
  762. PSZ FN_E strinsc(PSZ, CHAR, SIZET);
  763. PSZ FN_E strnzcpy(PSZ, PCSZ, SIZET);
  764. PSZ FN_E strord(LONG);
  765. PSZ FN_E strskip2ws(PSZ);
  766. PSZ FN_E strskipws(PCSZ);
  767. PSZ FN_E strskipzero(PCSZ);
  768. PSZ FN_E strstripcntrl(PSZ);
  769. PSZ FN_E strtrim(PSZ);
  770. PSZ FN_E strtrimleft(PSZ);
  771. PSZ FN_E strtrimright(PSZ);
  772.  
  773. //
  774. //    bsstr1.c
  775. //
  776. BOOL FN_E strvaliddouble(PSZ, PDOUBLE);
  777.  
  778. //
  779. //    bsstr2.c
  780. //
  781. BOOL FN_E strisnumeric(PCSZ);
  782. BOOL FN_E strisnumeric2(PCSZ);
  783. BOOL FN_E strisphone(PCSZ);
  784. BOOL FN_E strisvalid(PCSZ, PCSZ);
  785. BOOL FN_E strvalidlong(PCSZ, PLONG);
  786. BOOL FN_E strvalidshort(PCSZ, PSHORT);
  787. BOOL FN_E strvalidulong(PCSZ, PULONG);
  788. BOOL FN_E strvalidushort(PCSZ, PUSHORT);
  789.  
  790. //
  791. //    bsswap.c
  792. //
  793. VOID FN_E Swapping(void);
  794.  
  795. //
  796. //    bsthread.c
  797. //
  798. #if (OS_OS2 || OS_PM) && COMPILE_MT
  799. #     define THREADID        ((TID)_threadid)
  800. #else
  801. #     define THREADID        ((TID)1)
  802. #endif
  803.  
  804. #define ThreadEnd()    __ThreadEnd(); return ;
  805.  
  806. VOID FN_E __ThreadEnd(void);
  807. TID FN_E ThreadId(void);
  808. BOOL FN_E ThreadStart(PFNTHRD, PTID, PVOID);
  809.  
  810.  
  811. //
  812. //    bstitle.c
  813. //
  814. VOID FN_E BaseTitle(PSZ, PCSZ, PCSZ, PCSZ);
  815. BOOL FN_E BaseTitleHelp(PBS_CMDOPT, PCSZ DFTPARM(NULL), FLAG16 DFTPARM(0));
  816.  
  817. //
  818. //    bsumb.c
  819. //
  820. SHORT FN_E UmbGetState(void);
  821. VOID FN_E UmbSetState(SHORT);
  822.  
  823.  
  824. //
  825. //    bsunix.c
  826. //
  827. #if OS_UNIX
  828. int memcmp(const void *__s1, const void *__s2, size_t __n);
  829. int stricmp(const char *, const char *);
  830. char *strlwr(char *);
  831. int strnicmp(const char *, const char *, size_t);
  832. char *strupr(char *);
  833.  
  834. //
  835. //    Functions which SCO does not declare but supports anyway...
  836. //
  837. int atexit(void (*__func)(void));
  838. void _exit(int);
  839. int _filbuf(FILE *);
  840. int getpid(void);
  841. int open(const char  *, int,...);
  842. int rmdir(const char *);
  843. int unlink(char *);
  844.  
  845. #endif
  846.  
  847.  
  848. //
  849. //    bsver.c
  850. //
  851. PCSZ FN_E Version(PUSHORT, PUSHORT);
  852.  
  853.  
  854. //
  855. // bsvollbl.c
  856. //
  857. BOOL FN_E VolumeLabel(SHORT, PSZ);
  858.  
  859. //
  860. //    bswrap.c
  861. //
  862. BOOL FN_E strwrap(PCSZ _FAR_ *, SIZET, PSZ DFTPARM(NULL), BOOL DFTPARM(FALSE));
  863. SIZET FN_E strwrapcount(PCSZ, SIZET);
  864.  
  865. //----------------------------------------------------------------------------
  866. //------------------------------- End of File --------------------------------
  867. //----------------------------------------------------------------------------
  868.